home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Turnbull China Bikeride
/
Turnbull China Bikeride - Disc 1.iso
/
DEMON
/
RISCOS2
/
ARCKA9Q1.ARC
/
h
/
UDP
< prev
Wrap
Text File
|
1992-02-15
|
2KB
|
54 lines
/* User Datagram Protocol definitions */
#define NUDP 20
/* Structure of a UDP protocol header */
struct udp {
int16 source; /* Source port */
int16 dest; /* Destination port */
int16 length; /* Length of header and data */
int16 checksum; /* Checksum over pseudo-header, header and data */
};
#define UDPHDR 8 /* Length of UDP header */
/* User Datagram Protocol control block
* Each entry on the receive queue consists of the
* remote socket structure, followed by any data
*/
struct udp_cb {
struct udp_cb *prev; /* Linked list pointers */
struct udp_cb *next;
struct socket socket; /* Local port accepting datagrams */
void (*r_upcall)(); /* Function to call when one arrives */
struct mbuf *rcvq; /* Queue of pending datagrams */
int rcvcnt; /* Count of pending datagrams */
};
extern struct udp_cb *udps[]; /* Hash table for UDP structures */
#define NULLUDP (struct udp_cb *)0
/* UDP statistics counters */
struct udp_stat {
int16 rcvd; /* Packets received */
int16 sent; /* Packets sent */
int16 cksum; /* Checksum errors */
int16 unknown; /* Unknown socket */
int16 bdcsts; /* Incoming broadcasts */
};
/* In UDP */
int open_udp(struct socket *, void (*)());
int recv_udp(struct socket *, struct socket *, struct mbuf **);
int send_udp(struct socket *, struct socket *, char, char,
struct mbuf *, int16, int16, char);
int del_udp(struct socket *);
void udp_dump(struct mbuf **, int32, int32, int);
struct mbuf *htonudp(struct udp *, struct mbuf *, struct pseudo_header *);
void ntohudp(struct udp *, struct mbuf **);
/* In UDPCMD */
int doudp(int, char **);
int doudpstat(int, char **);
/* In UDPDUMP */
void udp_dump(struct mbuf **, int32, int32, int);